home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#09 (Jun 86)
/
Forth source code
/
CRT saver
< prev
next >
Wrap
Text File
|
1986-04-07
|
1KB
|
86 lines
( CRT saver task, © 1986 JL for MacTutor)
only forth definitions
also assembler also mac
hex
904 constant currentA5
9EE constant grayRgn
16A constant Ticks
74 constant screenbits
10 constant portrect
decimal
( first define port structure )
header screenport
2 allot ( device )
14 allot ( bitmap )
8 allot ( portrect )
84 allot ( remaining bytes )
( *** now define background task that does the blanking *** )
variable last.action
variable max.ticks
3600 max.ticks ! ( 1 minute in ticks )
header myevents
2 allot ( code )
4 allot ( message )
4 allot ( when )
4 allot ( where )
2 allot ( modifiers )
: relevant.action
138 ( disk + key + mouse )
['] myevents call EventAvail
;
: redraw
call drawmenubar
call frontWindow
grayRgn @ call paintBehind
call showcursor
;
: blankout
call hidecursor
['] screenport call openport
['] screenport portrect + call paintrect
BEGIN relevant.action UNTIL
ticks @ last.action !
['] screenport call setport
redraw
;
: monitor.events
activate
BEGIN
PAUSE
relevant.action
IF ticks @ last.action ! THEN
AGAIN
;
: do.blank
activate
BEGIN
PAUSE
ticks @ last.action @ - max.ticks @ >
IF blankout THEN
AGAIN
;
400 1000 background CRTsaver
CRTsaver build
400 1000 background eventmonitor
eventmonitor build
: saver.start
ticks @ last.action !
eventmonitor monitor.events
CRTsaver do.blank
;